﻿using System;
using System.Numerics;

namespace BassTutor.Analysis
{
    class NaiveDFTT : IDFT
    {
        public double[] dft(double[] data)
        {
            int N = data.Length;
            Complex y;
            double[] output = new double[N];

            for (int k = 0; k < N; ++k)
            {
                y = 0;
                for (int n = 0; n < N; ++n)
                    y += data[n] * Complex.Pow(Math.E, -2.0 * Math.PI * n * k * Complex.ImaginaryOne / N);
                output[k] = y.Magnitude;
            }
            return output;
        }
    }
}
